RO42 - Introduction to Free Pascal support
The RemObjects
SDK 'Vinci' release contains the first support for Free Pascal as an additional
platform for the Delphi edition.
Free Pascal is a Delphi compatible Pascal Compiler for amongst others:
- 32 bit Windows
- 64bits Windows
- Linux platforms.
Important note: Initially, the support is for the Free Pascal Compiler (FPC). We plan to add support for the Lazarus IDE in one of the bi-monthly updates to the RemObjects SDK, and this article will then be updated appropriately. However, as this article illustrates, it is already possible to use the Delphi IDE to create Free Pascal servers.
Pre-requisites
For this article, it is assumed that you have some knowledge of creating RemObjects SDK servers and clients. If not, see these articles first:
- RO05 - How to Write a RemObjects SDK Server (Delphi Version)
- RO06 - How to Write a RemObjects SDK Client (Delphi Version)
- RO25 - Understanding the Client Side
To perform the steps presented in this article, you will need to install the the following:
- Free Pascal from http://www.freepascal.org.
- Free Pascal port of Indy from http://www.indyproject.org/Sockets/fpc/index.en.aspx
- The RemObjects SDK - 'Vinci' version or later.
Example
As implied above, we'll create an application in Delphi, for subsequent deployment under Linux.
The first step is to create a new Command Line Server application:
The command line server is a command line based Server application that can easily be compiled in Free Pascal. We'll follow the wizard and use the default options. Next, we open the Service Builder by clicking the RemObjects SDK | Edit Service Library menu item. By default, the wizard adds a new service and two methods. For this article, we'll use these methods to show the Free Pascal support.
Close the Service Builder and build the application. A wizard will display asking for the kind of service to create:
The first option: "Simple Object" is the one that requires the least changes under Free Pascal, so we'll choose that. The wizard will create a unit with implementations for the Sum and GetServiceTime methods. We'll add a simple 'Result := a + b' for the Sum method and 'Result := Now' for the GetServerTime method.
That's it! Save all files and the Delphi IDE can be closed.
Prepare for Free Pascal Use
A few simple steps are all that is required:
First, rename the .dpr file to .pas and open the server in the Free Pascal console IDE (FP). Next, add RemObjects SDK and Indy to the 'Units' tab:
For the 'Include Files' tab, only 'RemObjects SDK for Delphi\Source' is needed.
Finally, when running on Windows, you will need the precompiled ZLib1.dll from http://www.zlib.net in the path to run the application. On most UNIX derivatives, this will already be installed.
That’s all. Press Ctrl+F9 to run the server:
You can now use this service from Free Pascal, Delphi or .NET, like you would for any kind of service. The instructions above showed Windows for the Free Pascal part, but the instructions are exactly the same when running Free Pascal on Linux.



Delphi |
Free Pascal
